package pl.edu.agh.inpema.components.receivers.phpBB2Receiver.parser.filters;

import org.htmlparser.Node;
import org.htmlparser.NodeFilter;
import org.htmlparser.nodes.TagNode;

public class ContentTypeFilter implements NodeFilter {
	
	public boolean accept(Node node) {
		if (node instanceof TagNode) {
			TagNode tag = (TagNode) node;
			if (! "meta".equals(tag.getTagName().toLowerCase()))
				return false; 
			
			String equivAttribute =  tag.getAttribute("http-equiv");
			if (equivAttribute == null)
				return false;
			
			if (! "content-type".equals(equivAttribute.toLowerCase())) {
				return false;
			}
			return true;
		}
		return false;
	}

}
